<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .cube{
            width:200px;
            height: 200px;
            margin: 100px auto;
            position: relative;
            transition: all 2s;
            background-color: aqua;
            transform-style: preserve-3d;

            /* 透视距离要大于等于元素的宽度 一般建议取值800~1000*/
            /* perspective: 1000px; */


            /* 旋转与案例效果无关，用来看前后移动的效果 */
            /* transform: rotateY(45deg); */

        }

        .cube div{
            position: absolute;
            left: 0;
            top: 0;


            width: 200px;
            height: 200px;
        }

        .front{
            background-color: orange;
            transform: translateZ(100px);

        }

        .back{
            background-color: green;
            transform: translateZ(-100px);

        }

        .cube:hover{
            transform: rotateY(110deg);
        }

    </style>
</head>
<body>
    <div class="cube">
        <div class="front">前面</div>
        <div class="back">后面</div>

    </div>
</body>
</html>